Constants

SEPARATOR_ELEMENT

SEPARATOR_ELEMENT = ' '

SEPARATOR_ITEM

SEPARATOR_ITEM = '~'

SEPARATOR_LEVEL

SEPARATOR_LEVEL = ':'

Properties

$incomplete

$incomplete

$raw_data

$raw_data

$mailbox

$mailbox

$meta

$meta

$order

$order

Methods

__construct()

__construct(mixed  $mailbox = null, mixed  $data = null) : mixed

Object constructor.

Parameters

mixed $mailbox
mixed $data

Returns

mixed —

init()

init(string  $data = null) : mixed

Initializes object with IMAP command response

Parameters

string $data

IMAP response string

Returns

mixed —

is_error()

is_error() : bool

Checks the result from IMAP command

Returns

bool —

True if the result is an error, False otherwise

is_empty()

is_empty() : bool

Checks if the result is empty

Returns

bool —

True if the result is empty, False otherwise

count()

count() : int

Returns number of elements (threads) in the result

Returns

int —

Number of elements

count_messages()

count_messages() : int

Returns number of all messages in the result

Returns

int —

Number of elements

max()

max() : int|null

Returns maximum message identifier in the result

Returns

int|null —

Maximum message identifier

min()

min() : int|null

Returns minimum message identifier in the result

Returns

int|null —

Minimum message identifier

slice()

slice(int  $offset, int  $length) : mixed

Slices data set.

Parameters

int $offset

Offset (as for PHP's array_slice())

int $length

Number of elements (as for PHP's array_slice())

Returns

mixed —

filter()

filter(array  $roots) : mixed

Filters data set. Removes threads not listed in $roots list.

Parameters

array $roots

List of IDs of thread roots.

Returns

mixed —

revert()

revert() : mixed

Reverts order of elements in the result

Returns

mixed —

exists()

exists(int  $msgid, bool  $get_index = false) : bool

Check if the given message ID exists in the object

Parameters

int $msgid

Message ID

bool $get_index

When enabled element's index will be returned. Elements are indexed starting with 0

Returns

bool —

True on success, False if message ID doesn't exist

get()

get() : array

Return IDs of all messages in the result. Threaded data will be flattened.

Returns

array —

List of message identifiers

get_compressed()

get_compressed() : array

Return all messages in the result.

Returns

array —

List of message identifiers

get_element()

get_element(int|string  $index) : int

Return result element at specified index (all messages, not roots)

Parameters

int|string $index

Element's index or "FIRST" or "LAST"

Returns

int —

Element value

get_parameters()

get_parameters(string  $param = null) : array|string

Returns response parameters e.g. MAILBOX, ORDER

Parameters

string $param

Parameter name

Returns

array|string —

Response parameters or parameter value

sort()

sort(\rcube_result_index  $index) : mixed

THREAD=REFS sorting implementation (based on provided index)

Parameters

\rcube_result_index $index

Sorted message identifiers

Returns

mixed —

get_tree()

get_tree() : array

Returns data as tree

Returns

array —

Data tree

get_thread_data()

get_thread_data() : array

Returns thread depth and children data

Returns

array —

Thread data

build_thread_data()

build_thread_data(mixed  $data, mixed  $depth, mixed  $children, mixed  $level) : mixed

Creates 'depth' and 'children' arrays from stored thread 'tree' data.

Parameters

mixed $data
mixed $depth
mixed $children
mixed $level

Returns

mixed —

build_thread()

build_thread(mixed  $items, mixed  $level = 1, mixed  $pos) : mixed

Converts part of the raw thread into an array

Parameters

mixed $items
mixed $level
mixed $pos

Returns

mixed —

parse_thread()

parse_thread(mixed  $str, mixed  $begin, mixed  $end, mixed  $depth) : mixed

IMAP THREAD response parser

Parameters

mixed $str
mixed $begin
mixed $end
mixed $depth

Returns

mixed —